package com.javen.bankpay;

import java.util.List;

import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class ChangeDebitFee extends Thread{
	static Log log = Log.getLog(ChangeDebitFee.class);

	
	@Override
	public void run(){
		while (true)
		{
			try{
				changeDebitFee();
			} catch (Exception e) {
				log.error(e.getMessage(),e);
			}
			
			try {
				Thread.sleep(300000);
			} catch (InterruptedException e) {
				log.error(e.getMessage(),e);
			}
			
		}
	}
	
	public void changeDebitFee(){
		List<Record> debits = Db.find("select * from debit_card");
		for(Record debit : debits){
			PayInterfaceController.changeDebit(debit, debit, "change");
		}
	}
	
}
